﻿@model PopForums.Models.PagedTopicContainer
@using PopForums.Controllers
@using PopForums.Extensions;
@{
    ViewBag.Title = PopForums.Resources.SubscribedTopics;
    Layout = "~/Areas/PopForums/Views/Shared/PopForumsMaster.cshtml";
}

@section HeaderContent {
	<script type="text/javascript" language="javascript">
		$(function () {
			PopForums.topicPreviewSetup();
			PopForums.startTimeUpdater();
		});
	</script>
}

<div id="TopBreadcrumb" class="navAbsolute">
	<h1>@PopForums.Resources.SubscribedTopics</h1>
	<p>
		@Html.ActionLink(PopForums.Resources.Recent, "Recent", ForumController.Name, new { page = 1 }, null)
		^ @Html.ActionLink(PopForums.Resources.Forums, "Index", ForumHomeController.Name, null, null)
	</p>
</div>

@if (Model == null)
{
	<p>@PopForums.Resources.SubscribeLoggedIn</p>
}
else
{
	if (Model.Topics.Count == 0)
	{
		<p>@PopForums.Resources.SubscribeNone</p>
	}
 
	@Html.PagerLinks("Subscription", "Topics", Model.PagerContext, "pagerLinks", "morePager", "currentPager")

	<table class="forumGrid">
		@foreach (var topic in Model.Topics)
  {
			<tr @if (topic.IsDeleted){<text> class="deletedItem"</text> }>
				<td class="newIndicator"><a href="@Url.Action("GoToNewestPost", "Forum", new { id = topic.TopicID })">@Html.TopicReadIndicator(topic, Model, "/Content/PopForums/")</a></td>
				<td class="topicListButton">
					@using (Html.BeginForm("Unsubscribe", "Subscription"))
	 {
						@Html.Hidden("id", topic.TopicID)
						<input type="submit" value="@PopForums.Resources.Unsubscribe" />
	 }
				</td>
				<td>
					<h2>@Html.ActionLink(topic.Title, "Topic", "Forum", new { id = topic.UrlName, page = 1 }, null) <span class="topicPreviewButton" title="@PopForums.Resources.PreviewTopic" topicID="@topic.TopicID">&gt;&gt;</span></h2>
					<div id="TopicPreview@(topic.TopicID)" class="topicPreview"></div>
					<p class="forumStatData">
						@PopForums.Resources.StartedBy: @topic.StartedByName @PopForums.Resources.In @Model.ForumTitles[topic.ForumID] | @PopForums.Resources.Views: @topic.ViewCount | @PopForums.Resources.Replies: @topic.ReplyCount | @PopForums.Resources.Last: <span class="lastPostTime fTime" data-utc="@FormatTime8601(topic.LastPostTime)">@FormatTime(topic.LastPostTime)</span> @PopForums.Resources.By @topic.LastPostName
					</p>
				</td>
			</tr>
  }
	</table>
}